<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<meta name="viewport" content="width=1000, initial-scale=1.0, maximum-scale=1.0">
	    <!-- Loading Bootstrap -->
	    <link href="Public/Admin/Flat/dist/css/vendor/bootstrap.min.css" rel="stylesheet">
	    <!-- Loading Flat UI -->
	    <link href="Public/Admin/Flat/dist/css/flat-ui.css" rel="stylesheet">
	    <link href="Public/Admin/Flat/docs/assets/css/demo.css" rel="stylesheet">
	    <link rel="shortcut icon" href="Public/Admin/Flat/img/favicon.ico">
	    <!--载入百度编辑器-->
	    	<script type="text/javascript" charset="utf-8" src="Public/ueditor1_4_3/ueditor.config.js"></script>
    		<script type="text/javascript" charset="utf-8" src="Public/ueditor1_4_3/ueditor.all.min.js"> </script>
    		<script type="text/javascript" charset="utf-8" src="Public/ueditor1_4_3/lang/zh-cn/zh-cn.js"></script>
    		<!--引入js-->
    		<script src="Public/jquery-1.8.2.min.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
		<form action="" method="post" enctype="multipart/form-data">
		<div class="alert alert-success">编辑文章</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章标题</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder=""  name="title" value="<?php echo $oldData['title']?>">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">作者</label>
			<input id="exampleInputEmail1" class="form-control" type="text" placeholder=""  name="author" value="<?php echo $oldData['author']?>">
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">所属分类</label>
			<select name="category_cid" class="form-control">
				<option value="0">请选择</option>
				<!--循环分类数据,如果旧数据=分类数据-->
				<?php foreach ($cateData as $v){?>
					<option value="<?php echo $v['cid']?>"  <?php if($oldData['category_cid'] = $v['cid']){?>
                 selected 
               <?php }?>  ><?php echo $v['_name']?></option>
				<?php }?>
			</select>
		</div>
		<!--缩略图-->
		<div class="form-group">
			<label for="exampleInputEmail1">缩略图</label>
			<div id="thumbBox">
				<div id="imgShow">
					<img src="<?php echo $oldData['thumb']?>" style="width: 150px;"/>
					<a href="javascript:;" id="close">X</a>
					<input type="hidden" name="thumb" value="<?php echo $oldData['thumb']?>" />
				</div>
			</div>
			<script type="text/javascript">
				$(function(){
					$('#close').click(function(){
						//要删除图片和隐藏域元素
						$('#imgShow').remove();
						//插入上传表单
						$('#thumbBox').html('<input type="file" name="thumb" id="" />');
					})
				})
			</script>


		</div>
		
		
		<div id="">
			<label for="">文章标签</label>
			<br />
			<?php foreach ($tagData as $v){?>
				<label class="checkbox checkbox-inline" for="checkbox<?php echo $v['tid']?>">
					<input id="checkbox<?php echo $v['tid']?>" class="custom-checkbox" type="checkbox" data-toggle="checkbox" value="<?php echo $v['tid']?>" <?php if(in_array($v['tid'],$tids)){?>
                checked
               <?php }?> name="tid[]">
					<span class="icons">
					<span class="icon-unchecked"></span>
					<span class="icon-checked"></span>
					</span>
					<?php echo $v['tname']?>
				</label>
			<?php }?>
		</div>
		<div class="form-group">
			
			<label for="exampleInputEmail1">文章摘要</label>
			<textarea name="digest" rows="5" cols=""  class="form-control" placeholder=""><?php echo $oldData['digest']?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章关键字</label>
			<textarea name="keywords" rows="5" cols=""  class="form-control" placeholder=""><?php echo $oldData['keywords']?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章描述</label>
			<textarea name="des" rows="5" cols=""  class="form-control" placeholder=""><?php echo $oldData['des']?></textarea>
		</div>
		<div class="form-group">
			<label for="exampleInputEmail1">文章正文</label>
			<!--载入百度编辑器-->
			<script id="editor" type="text/plain" style="width:100%;height:500px;" name="content"><?php echo $oldData['content']?></script>
		    <script>
		        var ue = UE.getEditor('editor');
		    </script>
		</div>
		<!--加入隐藏域可以在编辑的时候找到要编辑的数据,不需要where条件-->
		<input type="hidden" name="aid" value="<?php echo $_GET['aid']?>"/>
		<button class="btn btn-primary btn-block" type="submit"> 确定 </button>
		</form>
	</body>
</html>
